package version2024.easy;

import java.util.Scanner;

/**
 * @author sunhl
 * @Description: HJ37 统计每个月兔子的总数
 * @Date: created in 2025/1/14 星期二 17:12
 * @Modified By:
 */
public class HJ37_StatisticsTotalNumberOfRabbitsPerMonth {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            // 3个月
            // 1 1
            // 2 1
            // 3 1 + 1 = 2
            // 4 1 + 1 + 1 = 3
            // 5 1 + 1 + 1 + 1 + 1 = 5
            // 是个斐波那契数列

            System.out.println(dp(n));
        }
    }

    public static int dp(int n) {
        int num[] = new int[n + 1];
        num[1] = 1;
        num[2] = 1;

        for (int i = 3; i <= n; i++) {
            num[i] = num[i - 1] + num[i - 2];
        }
        return num[n];
    }
}
